import axios from 'axios'
import {API_ROOT} from '../util/config'
const httproot ="http://1.dltest.applinzi.com/test2.php"
const httprootget ="http://1.dltest.applinzi.com/get.php"
const httpkuaxueResource="http://api.kuaxue.com/KuaxueResource/"
const httpkuaxueVideo="http://api.kuaxue.com/KuaxueVideo/"
const appId='vke8u7u7y3'
const qs = require('qs')
export default {
//获取登录用户的信息
getUserInfo(params){
	 return axios.get('http://web.skyeducation.cn/getUserinfo.php', {
      params
    }); 
},
  // 获取分组学生列表
  getGroupResult(params) {
    return axios.get(API_ROOT+'action=getGroupResult', {
      params
    });
  },
  //保存分组学生
  saveGroupResult(params){
  	return axios.get(API_ROOT+'action=saveGroupResult',{
  		params
  	})
  },
  //重置分组
  emptyGroupResult(params){
  	return axios.get(API_ROOT+'action=emptyGroupResult',{
  		params
  	})
  },
  //获取各学段及对应的科目
  getListSubject(params){
  	return axios.post(httproot,qs.stringify({'appId':appId})).then(function(out){
  		return axios.post(httprootget,qs.stringify({url:httpkuaxueResource+'getListSubject?sign='+out.data+'&appid='+appId}))
  	})
  },
  //通过科目id获取科目对应的题型
  getQuestionType(params){
  	return axios.post(httproot,qs.stringify({'appId':appId})).then(function(out){
  		return axios.post(httprootget,qs.stringify({url:httpkuaxueResource+'getListQuestionType?sign='+out.data+'&appid='+appId+'&subject_id='+params}))
  	})
  },
  //获取试题的级别难易度
  getListQuestionLevel(params){
  	return axios.post(httproot,qs.stringify({'appId':appId})).then(function(out){
  		return axios.post(httprootget,qs.stringify({url:httpkuaxueResource+'getListQuestionLevel?sign='+out.data+'&appid='+appId}))
  	})
  },
  //根据科目ID获取章节或知识点的结构
  getKnowledges(params){
  	return axios.post(httproot,qs.stringify({'appId':appId})).then(function(out){
  		return axios.post(httprootget,qs.stringify({url:httpkuaxueResource+'getListCategory?sign='+out.data+'&appid='+appId+'&subject_id='+params.subject_id+"&type="+params.type}))
  	})
  },
  //根据结构ID、题型ID、级别ID获取试题列表
  getListQuestion(params){
  	return axios.post(httproot,qs.stringify({'appId':appId})).then(function(out){
  		return axios.post(httprootget,qs.stringify({url:httpkuaxueResource+'getListQuestion?sign='+out.data+'&appid='+appId+'&category_id='+params.category_id+"&type_id="+params.type_id+"&level_id="+params.level_id+"&page="+params.page}))
  	})
  },
  //根据试题id获取试题
  getListQuestionById(tid){
  	return axios.post(httproot,qs.stringify({'appId':appId})).then(function(out){
  		return axios.post(httprootget,qs.stringify({url:httpkuaxueResource+'getOneQuestion?sign='+out.data+'&appid='+appId+'&tid='+tid}))
  	})
  }, 
  //获取视频的知识点结构目录 type 1教材同步，2知识点
  getVideoKnowledges(type){
  	return axios.post(httproot,qs.stringify({'appId':appId})).then(function(out){
  		return axios.post(httprootget,qs.stringify({url:httpkuaxueVideo+'classify/'+out.data+'/'+appId+'/'+type}))
  	})
  }, 
  //获取视频参数3=结构id（第2个接口中的id），*参数4=知识点的级别值（第2个接口中的type），*参数5=每页条数，*参数6=页码（选填）
  getVideoList(id,typeid,pagesize,page){
  	return axios.post(httproot,qs.stringify({'appId':appId})).then(function(out){
  		return axios.post(httprootget,qs.stringify({url:httpkuaxueVideo+'getVideoList/'+out.data+'/'+appId+'/'+id+'/'+typeid+'/'+pagesize+'/'+page}))
  	})
  }, 
  //获取备课资料的类型列表
  getDocumentType(params){
  	return axios.post(httproot,qs.stringify({'appId':appId})).then(function(out){
  		return axios.post(httprootget,qs.stringify({url:httpkuaxueResource+'getDocumentType?sign='+out.data+'&appid='+appId}))
  	})
  },  
  //根据结构ID、类型ID获取备课资料列表
  getListDocument(params){
  	return axios.post(httproot,qs.stringify({'appId':appId})).then(function(out){
  		return axios.post(httprootget,qs.stringify({url:httpkuaxueResource+'getListDocument?sign='+out.data+'&appid='+appId+'&category_id='+params.category_id+"&type_id="+params.type_id+"&page="+params.page}))
  	})
  },  
  //获取某个视频详情
  getVideoDetail(id){
  	return axios.post(httproot,qs.stringify({'appId':appId})).then(function(out){
  		return axios.post(httprootget,qs.stringify({url:httpkuaxueVideo+'videos/'+out.data+'/'+appId+'/'+id}))
  	})
  },   
	//根据题型数量，难易度，知识点或章节ID,返回对应题型个数的试题
	getTestQuestionList(params){
  	return axios.post(httproot,qs.stringify({'appId':appId})).then(function(out){
  		return axios.post(httprootget,qs.stringify({url:httpkuaxueResource+'getTypetionList?sign='+out.data+'&appid='+appId+'&cateId='+params.cate_id+'&levelId='+params.level_id+'&typeId='+params.type_id}))
  	})
 },
  //添加题目到收藏夹
  addToCollect(data){
  	 return axios.post(API_ROOT+'action=addTeacherFavorite', data)
  },
  //获取收藏夹题目
  getTeacherFavoriteList(params){
  	return axios.get(API_ROOT+'action=getTeacherFavoriteList',{
  		params
  	})
  },  
  //获取所有收藏夹题目的id集合
  getTeacherFavoriteTestids(params){
  	return axios.get(API_ROOT+'action=getTeacherFavoriteTestids',{
  		params
  	})
  },
  //删除收藏夹题目
  deleteTeacherFavorite(params){
  	return axios.get(API_ROOT+'action=deleteTeacherFavorite',{
  		params
  	})
  },
  //获取套卷
  getTest(params){
  	return axios.get(API_ROOT+'action=getTeacherQuestionList',{
  		params
  	})
  },
  //删除试卷
  deleteTest(params){
  	return axios.get(API_ROOT+'action=deleteTeacherQuestion',{
  		params
  	})
  },
  //添加套卷
  addTest(params){
  	return axios.get(API_ROOT+'action=addTeacherQuestion',{
  		params
  	})
  },
  //修改套卷
  modifiTest(params){
  	return axios.get(API_ROOT+'action=updateTeacherQuestion',{
  		params
  	})
  },
  //课堂回顾
  getLessonReviews(params){
  	return axios.get(API_ROOT+'action=getLessonReviews',{
  		params
  	})
  },
  //总览信息
  getLessonReviewStatistics(params){
  	return axios.get(API_ROOT+'action=getLessonReviewStatistics',{
  		params
  	})
  },
  //课堂习题统计
   getXitiStatistics(params){
  	return axios.get(API_ROOT+'action=getXitiStatistics',{
  		params
  	})
  },
  //课堂回顾批注统计
   getDrawViewStatistics(params){
  	return axios.get(API_ROOT+'action=getDrawViewStatistics',{
  		params
  	})
  },
  //全体作答统计
   getResourceXitiStatistics(params){
  	return axios.get(API_ROOT+'action=getResourceXitiStatistics',{
  		params
  	})
  },
  //抢答统计
   getCompetiveStatistics(params){
  	return axios.get(API_ROOT+'action=getCompetitiveStatistics',{
  		params
  	})
  },
  //点名统计
   getCallnameStatistics(params){
  	return axios.get(API_ROOT+'action=getCallnameStatistics',{
  		params
  	})
  },
   //小组作答统计
   getGroupRaceStatistics(params){
  	return axios.get(API_ROOT+'action=getGroupRaceStatistics',{
  		params
  	})
  },
  //套卷答题统计
   getMoreQuestionsStatistics(params){
  	return axios.get(API_ROOT+'action=getMoreQuestionsStatistics',{
  		params
  	})
  },
  //布置作业记录信息
   getrAssignmentRecordList(params){
  	return axios.get(API_ROOT+'action=getrAssignmentRecordList',{
  		params
  	})
  },
  //查看作业记录成绩
   getDetailsOfAssignmentRecord(params){
  	return axios.get(API_ROOT+'action=getDetailsOfAssignmentRecord',{
  		params
  	})
  },
  //增加布置作业
   addAssignmentRecord(params){
  	return axios.get(API_ROOT+'action=addAssignmentRecord',{
  		params
  	})
  },
  //作业信息列表
   getTeacherAssignmentList(params){
  	return axios.get(API_ROOT+'action=getTeacherAssignmentList',{
  		params
  	})
  },
  //增加作业信息
   addTeacherAssignment(params){
  	return axios.get(API_ROOT+'action=addTeacherAssignment',{
  		params
  	})
  },
  //修改作业信息
   updateTeacherAssignment(params){
  	return axios.get(API_ROOT+'action=updateTeacherAssignment',{
  		params
  	})
  },
  //删除作业信息
   deleteTeacherAssignment(params){
  	return axios.get(API_ROOT+'action=deleteTeacherAssignment',{
  		params
  	})
  },
  // 修改密码
  Forgetpwd(data) {
    return axios.post(API_ROOT, data)
  }
}

